/**
 * Copyright (C) 2010-2013 Alibaba Group Holding Limited
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.alibaba.rocketmq.client.impl.consumer;

import com.alibaba.rocketmq.common.message.MessageExt;
import com.alibaba.rocketmq.common.message.MessageQueue;
import com.alibaba.rocketmq.common.protocol.body.ConsumeMessageDirectlyResult;

import java.util.List;


/**
 * @author shijia.wxr<vintage.wang@gmail.com>
 * @since 2013-7-24
 */
public interface ConsumeMessageService {
    void start();


    void shutdown();


    void updateCorePoolSize(int corePoolSize);


    void incCorePoolSize();


    void decCorePoolSize();


    int getCorePoolSize();


    /**
     * 直接消费消息，主要用于通过管理命令收到消费消息
     * @param msg
     * @param brokerName
     * @return
     */
    ConsumeMessageDirectlyResult consumeMessageDirectly(final MessageExt msg, final String brokerName);


    /**
     * 提交消息消费
     * @param msgs 消息列表，默认一次从服务器最多拉取32 条。
     * @param processQueue 消息处理队列
     * @param messageQueue 消息所属消费队列
     * @param dispathToConsume 是否转发到消费线程池，并发消费时忽略该参数
     */
    void submitConsumeRequest(//
                              final List<MessageExt> msgs, //
                              final ProcessQueue processQueue, //
                              final MessageQueue messageQueue, //
                              final boolean dispathToConsume);
}
